home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1993 September / clonecd / September 93.img / Archives / Applications / Graphics / image / Pico 2.0 / Read Me! < prev    next >
Text File  |  1991-08-22  |  5KB  |  121 lines

  1. #
  2. # Welcome to Pico.  Pico ("Picture Composition") is described in
  3. # Gerard Holzmann's book, "Beyond Photography - the Digital Darkroom"
  4. # (published by Prentice Hall).  Pico takes an expression, similar to 
  5. # assignment statements in the C language, and applies that expression
  6. # to every pixel in the image.  This file contains some demonstration
  7. # expressions.
  8. #
  9. # (Note: Before proceeding ahead, use the “Monitors” icon in the
  10. #  control panel to set your screen to the maximum number of grays or colors.)
  11. #
  12. # The destination of Pico expressions is always an image variable 
  13. # called "new".  For example, consider the expression:
  14.  
  15.    new[x,y] = x
  16. # If you click the cursor on the line above and hit the “Enter” key, you
  17. # should see a nice ramp of gray (dark on the left, light on the right) in
  18. # the “Image” window.  What the expression means is “assign each pixel the
  19. # value of its x coordinate” (x increases from left to right, y increases from
  20. # bottom to top)
  21. #
  22. # Since the destination image must be "new", the left side of the equation
  23. # can be omitted if's the default, new[x,y].  E.g, the following line:
  24.    y
  25. #
  26. # produces a ramp from top to bottom if you move the cursor on it and
  27. # hit Enter.  The results of a computation are saved in a special image
  28. # called "old".  So if you evaluate:
  29.  
  30.    old[y,x]
  31.  
  32. # you see the previous image (the ramp) with its coordinates swapped, which
  33. # rotates it 90 degrees.
  34. #
  35. # If the value of a pixel exceeds the maximum (255), the value mod 255 is
  36. # displayed (i.e., the value “wraps around”).
  37. #
  38. # The program defines a few useful constants, X and Y are the maximum 
  39. # x and y coordinates, and Z is the maximum brightness of a pixel.
  40. #
  41. # Now try some expressions from Holzmann's book:
  42.  
  43. x + y
  44. (Z*x*y)/((X-1)*(Y-1))
  45. x%(y+1)
  46. x | y
  47.  
  48. #
  49. # You can also work in polar coordinates.  The variable "a" is set to the
  50. # angle of a pixel's position from the x axis.  The variable "r" (radius) is
  51. # the distance a particular pixel is from the center of the screen.  The
  52. # constant "A" is the maximum angle (360) and "R" is the maximum radius (181).
  53. # Here's a couple expressions to help visualize this:
  54. #
  55. (Z * a) / A    # Brightness increases with angle
  56. (Z * r) / R    # Brightness increases with radius
  57.  
  58. # Some fun things to do with polar coordinates:
  59.  
  60. (((a+r)%16)-8)*Z / 16+Z/2
  61. (r > 100 ) ? X-x : (r < 50) ? X-x : x
  62. (((a+1) / 30) % 2 == 0) ? r : Z-r
  63. (r>80) ? ((((a+1)/30)%2 == 0) ? r:Z-r) : Z - ((((a+1)/30)%2 == 0) ? r : Z-r)
  64. (a + 1) % 2 ? 0 : Z
  65. ((Z * a) / A) | ((Z * r) / R)
  66.  
  67. #
  68. # Of course, it's much more interesting to use Pico to process digital images.
  69. # Use “Load Image” from the “Image” menu to load the image “lenna” into Pico.
  70. #
  71. # Now you can use Pico expressions to process the image:
  72.  
  73. lenna[x+(x%32)-16,y]
  74. new = (lenna[x+1,y] + lenna[x-1,y] + lenna[x,y+1] + lenna[x,y-1])/4
  75. (x < 128) ? lenna : lenna[X-x,y]
  76. lenna[(a * X) / A, (r * Y) / R]
  77. lenna + (Z/2-lenna[x+2,y+2])
  78. lenna[(x/8) * 8, (y/8) * 8]
  79. lenna[x+((a+r/10)%32)-16,y]
  80. lenna;(old >= 64 && old < 192) ? old * 2 - 128 : (old < 64 ? 0 : Z)
  81.  
  82.  
  83. # Also, you can use Pico to combine multiple images.  For example,
  84. # load the image "clouds" and try the following:
  85.  
  86. clouds
  87. (lenna * clouds) / Z
  88. (clouds > Z/5) ? lenna : lenna / 3
  89. (lenna * clouds) / Z + (Z-clouds)
  90. (x<X/3) ? clouds : ((x>2 * X/3) ? lenna : ((x-X/3)*lenna+(2*X/3-x)*clouds)/(X/3))
  91. lenna[x,y+clouds/12]
  92.  
  93. # If you find the above a bit confusing, the best thing to do is obtain
  94. # a copy of Holzmann's book - it goes into much more detail, and has
  95. # a large collection of interesting expressions.  Also, if you need help
  96. # with the menus, try turning on "Show Balloons" and pointing at the menus
  97. # (if you're running System 7)
  98. #
  99. # In addition to processing images with expressions, several custom effects
  100. # are available in the “Effects” menu.  These operate on the currently 
  101. # displayed image.  If an Effect has "(Slow)" in its name, take this as a
  102. # warning that it may take a minute or two to run, depending on what 
  103. # kind of Mac you have.  Think C programmers can add their own effects, 
  104. # see the file “Adding effects” for instructions on how to do this.
  105. #
  106. ##################### Some notes about the Mac version #####################
  107. #
  108. # You can play with the subscripts on the left hand side.  E.g.:
  109.  
  110. 0;0;new[x,(y+lenna/8) % Y] = lenna[x,y]
  111.  
  112. # The "0"s are to clear out the image first, since every pixel isn't written.
  113. #
  114. # The "r" and "a" variables simply look up the radius and angle of the current
  115. # pixel.  They don't work on the left side as subscripts like Holzmann's do.
  116. #
  117. # Mac Pico reads standard PICT files, so you can use picture files generated
  118. # from other sources.  They will be scaled to fit the standard 256x256 gray
  119. # scale window when they are read in.  If the image window is selected, you
  120. # can copy an image from Pico for pasting into other applications.
  121.